window.CESIUM_BASE_URL = import.meta.env.VITE_APP_CESIUM;
console.log(window.CESIUM_BASE_URL);

import * as Cesium from 'cesium';
import "cesium/Build/Cesium/Widgets/widgets.css";

export const initCesium = () => {

    Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyZmYzNGNlNi02MmYxLTRhNGEtOWNmNS0yNDUyZjllMDdjZGYiLCJpZCI6MTE1NzI5LCJpYXQiOjE2NjkxMTg3NjB9.OwHxmlQbHzykfzV2z4b2x7jlZ-dEhe9EABxkuPfhUus";
    // Initialize the Cesium Viewer in the HTML element with the "cesiumContainer" ID.
    const viewer = new Cesium.Viewer('cesiumContainer', {
        terrainProvider: Cesium.createWorldTerrain(),
         infoBox: false
    });
    
    // Add Cesium OSM Buildings, a global 3D buildings layer.
    const buildingTileset = viewer.scene.primitives.add(Cesium.createOsmBuildings());
    // Fly the camera to San Francisco at the given longitude, latitude, and height.
    viewer.camera.flyTo({
        destination: Cesium.Cartesian3.fromDegrees(-122.4175, 37.655, 400),
        orientation: {
            heading: Cesium.Math.toRadians(0.0),
            pitch: Cesium.Math.toRadians(-15.0),
        }
    });
}